Refactor attributes benchmark tests#2167
Merged
MrAlias merged 2 commits intoopen-telemetry:mainfrom Aug 11, 2021
Merged
Conversation
Group benchmarks by type for easier understanding and filtering. Save output of function calls in benchmarks to file level vars to ensure the compiler does not optimize away the test. Unify testing functionality for common benchmark tasks.
Codecov Report
@@ Coverage Diff @@
## main #2167 +/- ##
=====================================
Coverage 72.3% 72.4%
=====================================
Files 176 176
Lines 12095 12095
=====================================
+ Hits 8755 8758 +3
+ Misses 3102 3100 -2
+ Partials 238 237 -1
|
jmacd
approved these changes
Aug 6, 2021
pellared
approved these changes
Aug 11, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2162
Group benchmarks by type for easier understanding and filtering. This also makes it easier to extend the benchmarks with the slice types in #2162.
Save output of function calls in benchmarks to file level vars to ensure the compiler does not optimize away the test.
Unify testing functionality for common benchmark tasks.
Results
$ go test -bench=. goos: linux goarch: amd64 pkg: go.opentelemetry.io/otel/attribute cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz BenchmarkBool/Value-8 837967860 1.365 ns/op 0 B/op 0 allocs/op BenchmarkBool/KeyValue-8 141840978 8.438 ns/op 0 B/op 0 allocs/op BenchmarkBool/AsBool-8 830254604 1.438 ns/op 0 B/op 0 allocs/op BenchmarkBool/Any-8 56767537 20.52 ns/op 0 B/op 0 allocs/op BenchmarkBool/Emit-8 152135484 8.150 ns/op 0 B/op 0 allocs/op BenchmarkBool/Array/KeyValue-8 6962660 171.9 ns/op 6 B/op 2 allocs/op BenchmarkBool/Array/Emit-8 4518294 264.8 ns/op 24 B/op 1 allocs/op BenchmarkInt/Value-8 878547782 1.362 ns/op 0 B/op 0 allocs/op BenchmarkInt/KeyValue-8 142509892 8.441 ns/op 0 B/op 0 allocs/op BenchmarkInt/Any-8 61482669 19.11 ns/op 0 B/op 0 allocs/op BenchmarkInt/Emit-8 100000000 10.20 ns/op 0 B/op 0 allocs/op BenchmarkInt/Array/KeyValue-8 6347354 189.1 ns/op 48 B/op 2 allocs/op BenchmarkInt/Array/Emit-8 3963114 293.2 ns/op 16 B/op 1 allocs/op BenchmarkInt8/Any-8 59708636 19.78 ns/op 0 B/op 0 allocs/op BenchmarkInt16/Any-8 61288166 19.17 ns/op 0 B/op 0 allocs/op BenchmarkInt32/Any-8 8011390 149.1 ns/op 16 B/op 2 allocs/op BenchmarkInt64/Value-8 872580108 1.398 ns/op 0 B/op 0 allocs/op BenchmarkInt64/KeyValue-8 141928178 8.446 ns/op 0 B/op 0 allocs/op BenchmarkInt64/AsInt64-8 832221681 1.437 ns/op 0 B/op 0 allocs/op BenchmarkInt64/Any-8 62070606 19.91 ns/op 0 B/op 0 allocs/op BenchmarkInt64/Emit-8 100000000 10.27 ns/op 0 B/op 0 allocs/op BenchmarkInt64/Array/KeyValue-8 6350991 188.1 ns/op 48 B/op 2 allocs/op BenchmarkInt64/Array/Emit-8 3714741 318.8 ns/op 16 B/op 1 allocs/op BenchmarkFloat64/Value-8 864163021 1.400 ns/op 0 B/op 0 allocs/op BenchmarkFloat64/KeyValue-8 142354496 8.416 ns/op 0 B/op 0 allocs/op BenchmarkFloat64/AsFloat64-8 830226676 1.438 ns/op 0 B/op 0 allocs/op BenchmarkFloat64/Any-8 55845655 18.90 ns/op 0 B/op 0 allocs/op BenchmarkFloat64/Emit-8 8898853 134.2 ns/op 16 B/op 2 allocs/op BenchmarkFloat64/Array/KeyValue-8 6252316 190.1 ns/op 48 B/op 2 allocs/op BenchmarkFloat64/Array/Emit-8 2609178 466.8 ns/op 16 B/op 1 allocs/op BenchmarkString/Value-8 183315844 6.536 ns/op 0 B/op 0 allocs/op BenchmarkString/KeyValue-8 134555676 8.902 ns/op 0 B/op 0 allocs/op BenchmarkString/AsString-8 639765589 1.884 ns/op 0 B/op 0 allocs/op BenchmarkString/Any-8 51048147 24.67 ns/op 0 B/op 0 allocs/op BenchmarkString/Emit-8 168750364 7.197 ns/op 0 B/op 0 allocs/op BenchmarkString/Array/KeyValue-8 5126845 231.6 ns/op 96 B/op 2 allocs/op BenchmarkString/Array/Emit-8 3758732 312.0 ns/op 48 B/op 1 allocs/op BenchmarkBytes/Any-8 44612653 28.33 ns/op 0 B/op 0 allocs/op BenchmarkStruct/Any-8 7722445 157.9 ns/op 16 B/op 2 allocs/op PASS